function save() {
	var editState = 0;
	if ("UPDATE" == method) {
		editState = 3;
	} else if ('INSERT' == method) {
		editState = 1;
	}
	if ($('#repassword').val() != $('#password').val()) {
		parent.layer.alert("两次输入的密码不一致");
		return;
	}
	var param = RS.getFormData('editForm');
	$.ajax({
			url : RS.webPath + "/admin/user/edit?organId=" + organId,
			type : 'post',
			data : 'editState=' + editState + '&method=' + method + '&__paramSet__=' + param,
			dataType : 'json',
			success : function(data) {
				if (data.status == 1) {
					parent.layer.alert('提交成功', function(index) {
						parent.layer.close(index);
						window.location.href = RS.webPath + "/admin/user?organId=" + organId;
					});
				} else {
					parent.layer.alert('提交失败');
				}
			}
	});
}

$(function() {
	if ("UPDATE" == method) {
		RS.loadForm('editForm', retInfo);
		$('#repassword').val($('#password').val());
	}
	var form = layui.form;
	/* 监听提交 */
	form.on('submit(submit-btn)', function(data) {
		save();
		return false;
	});
	form.render();
});
